home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / lib_test / test_array_to_external.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  1.4 KB  |  70 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_ARRAY_TO_EXTERNAL
  5.  
  6. creation make
  7.    
  8. feature 
  9.  
  10. -- *** t_double: ARRAY[DOUBLE];
  11.    t_boolean: ARRAY[BOOLEAN];
  12.    t_integer: ARRAY[INTEGER];
  13.    t_any: ARRAY[CAT];
  14.         
  15.    make is
  16.       local
  17.      cat: CAT;
  18.       do
  19.      t_boolean := <<true, false>>;
  20.      is_true(boolean(t_boolean.to_external));
  21.  
  22.      t_integer := <<4,5,6>>;
  23.      is_true(t_integer.first = integer(t_integer.to_external));
  24.  
  25. -- ***     t_double := <<(3.0).to_double>>;
  26. -- ***     is_true(double(t_double.to_external) = (3.0).to_double);
  27.  
  28.      !!cat;
  29.      t_any := <<cat,cat>>;
  30.      is_true(any(t_any.to_external) = cat);
  31.       end;
  32.  
  33. feature {NONE}
  34.    
  35.    boolean(p: POINTER): BOOLEAN is
  36.       do
  37.      Result := integer(p).to_boolean;
  38.       end;
  39.    
  40.    integer(p: POINTER): INTEGER is
  41.       do
  42.      c_inline_c("R=*((int *)a1);");
  43.       end;
  44.    
  45.    double(p: POINTER): DOUBLE is
  46.       do
  47.      c_inline_c("R=*((double *)a1);");
  48.       end;
  49.  
  50.    any(p: POINTER): ANY is
  51.       do
  52.      c_inline_c("R=*((void**)a1);");
  53.       end;
  54.  
  55.    is_true(b: BOOLEAN) is
  56.       do
  57.      cpt := cpt + 1;
  58.      if not b then
  59.         std_output.put_string("TEST_ARRAY_TO_EXTERNAL: ERROR Test # ");
  60.         std_output.put_integer(cpt);
  61.         std_output.put_string("%N");
  62.      else
  63.         -- std_output.put_string("Yes%N");
  64.      end;
  65.       end;
  66.    
  67.    cpt: INTEGER;
  68.    
  69. end -- TEST_ARRAY_TO_EXTERNAL
  70.